package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.model.mapper.VipLastGradeBakMapper;
import com.ttg.model.pojo.MctLastGradeBak;
import com.ttg.model.pojo.VipLastGradeBak;
import com.ttg.web.dao.VipLastGradeBakDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class VipLastGradeBakDaoImpl extends ServiceImpl<VipLastGradeBakMapper, VipLastGradeBak> implements VipLastGradeBakDao {
    @Override
    public VipLastGradeBak checkBakResultByDate(Integer checkDate) {
        LambdaQueryWrapper<VipLastGradeBak> wrapper = new LambdaQueryWrapper<>();
        wrapper.gt(VipLastGradeBak::getBakDate,checkDate)
                .last("limit 1");
        return getOne(wrapper);
    }

    @Override
    public void truncateOldRecords() {
        baseMapper.truncateOldRecords();
    }

    @Override
    public void vipBak(Integer date) {
        baseMapper.vipBak(date);
    }
}
